/*
 * @(#)SysFunction.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.framework.bean;

import java.lang.reflect.Method;

import com.dcivision.framework.TextUtility;

/**
  SysFunction.java

  This class is the serializable bean reflecting business logic uses.

    @author           Angus Shiu
    @company          DCIVision Limited
    @creation date    15/07/2003
    @version          $Revision: 1.6 $
*/

public class SysFunction extends AbstractBaseObject {

  public static final String REVISION = "$Revision: 1.6 $";

  static final long serialVersionUID = -7059557604446469738L;

  private String functionCode = null;
  private String functionName = null;
  private String functionNameZhHk = null;
  private String functionNameZhCn = null;
  private Integer parentID = null;
  private String linkUrl = null;
  private Integer displaySeq = null;
  private String menuType = null;
  private String permissionType = null;
  private String status = null;

  public SysFunction() {
    super();
  }

  public String getFunctionCode() {
    return(this.functionCode);
  }

  public void setFunctionCode(String functionCode) {
    this.functionCode = functionCode;
  }

  public String getFunctionName() {
    return(this.functionName);
  }

  public void setFunctionName(String functionName) {
    this.functionName = functionName;
  }

  public String getFunctionNameZhHk() {
    return(this.functionNameZhHk);
  }

  public void setFunctionNameZhHk(String functionNameZhHk) {
    this.functionNameZhHk = functionNameZhHk;
  }

  public String getFunctionNameZhCn() {
    return(this.functionNameZhCn);
  }

  public void setFunctionNameZhCn(String functionNameZhCn) {
    this.functionNameZhCn = functionNameZhCn;
  }

  public Integer getParentID() {
    return(this.parentID);
  }

  public void setParentID(Integer parentID) {
    this.parentID = parentID;
  }

  public String getLinkUrl() {
    return(this.linkUrl);
  }

  public void setLinkUrl(String linkUrl) {
    this.linkUrl = linkUrl;
  }

  public Integer getDisplaySeq() {
    return(this.displaySeq);
  }

  public void setDisplaySeq(Integer displaySeq) {
    this.displaySeq = displaySeq;
  }

  public String getMenuType() {
    return(this.menuType);
  }

  public void setMenuType(String menuType) {
    this.menuType = menuType;
  }

  public String getPermissionType() {
    return(this.permissionType);
  }

  public void setPermissionType(String permissionType) {
    this.permissionType = permissionType;
  }

  public String getStatus() {
    return(this.status);
  }

  public void setStatus(String status) {
    this.status = status;
  }

  public String getFunctionNameByLocale(java.util.Locale loc) {
    try {
      Class cls = this.getClass();
      String suffix = loc.toString().toLowerCase();
      String[] locStrAry = TextUtility.splitString(suffix, "_");
      suffix = "";
      for (int i = 0; i < locStrAry.length; i++) {
        suffix += Character.toUpperCase(locStrAry[i].charAt(0)) + locStrAry[i].substring(1);
      }
      Method mtd = cls.getMethod("getFunctionName" + suffix, null);
      String functionName = (String)mtd.invoke(this, null);
      return(functionName);
    } catch (Exception e) {
      return this.functionName;
    }
  }
}
